import request from '@/utils/request.js';

export function fetchProductList(params) {
    return request({
        url: "product_list",
        method: "get",
        params: params
    })
}

export function fetchProductAttrList(params) {
    return request({
        url: "get_product_attr",
        method: "get",
        params: params
    })

}

export function fetchBrand(params) {
    return request({
        url: "get_product_brand",
        method: "get",
        params: params
    })
}


export function fetchProductAttrBrand(params) {
    return request({
        url: "get_product_brand_pag",
        method: "get",
        params: params
    })

}


export function fetchCategory(params) {
    return request({
        url: "get_product_category",
        method: "get",
        params: params
    })
}

export function createProduct(data) {
    return request({
        url: "create_product",
        method: "post",
        data: data
    })
}

export function fetchProductCateList(params, parent_id) {
    return request({
        url: "get_product_category_list/" + parent_id, //从 后台api里面查找
        method: "get",
        params: params
    })
}
export function createProductCate(data) {
    return request({
        url: "create_product_cate",
        method: "post",
        data: data
    })
}

export function updateProduct(data) {
    return request({
        url: "update_product",
        method: "post",
        data: data
    })
}

export function getProductOne(params) {
    return request({
        url: "product_one",
        method: "get",
        params: params
    })
}


export function updateProductcta(data) {
    return request({
        url: "update_product_cate",
        method: "post",
        data: data
    })
}

export function getProductcatOne(params) {
    return request({
        url: "product_cate_one",
        method: "get",
        params: params
    })
}


export function delProduct(params) {
    return request({
        url: "delete_status",
        method: "get",
        params: params
    })
}


export function delProductcate(data) {
    return request({
        url: "delete_category",
        method: "post",
        data: data
    })
}